﻿@model Props.CustomWeb.Models.BaseModel
<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>@Model.VendorTitle</title>
    <!-- Le styles -->
    <link href="@Url.Content("~/content/css/bootstrap.css")" rel="stylesheet" />
    <style type="text/css">
    body 
    {
        @if (!String.IsNullOrWhiteSpace(Model.BackgroundUrl))
        {
            <text>background-image: url(@(Model.BackgroundUrl.StartsWith("~/Content") ? Url.Content(Model.BackgroundUrl) : Model.BackgroundUrl));</text>
        }
        @if (!String.IsNullOrWhiteSpace(Model.BackgroundColor))
        {
            <text>background-color: @Model.BackgroundColor;</text>
        }
		
		padding-top: 60px;
		padding-bottom: 40px;
    }
    </style>
    <link href="@Url.Content("~/content/css/bootstrap-responsive.css")" rel="stylesheet" />
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script type="text/javascript" src="http://html5shim.googlecode.com/svn/trunk/html5.js")"></script>
    <![endif]-->
    <!-- Le fav and touch icons
    <link rel="shortcut icon" href="../assets/ico/favicon.ico" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png" /> -->
    <!-- Le UserVoice widget -->
    <script type="text/javascript">
        var uvOptions = {};
        (function () {
            var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
            uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/gfHircSE5sWFnmw5vy8vw.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
        })();
    </script>
</head>
<body>
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span
                    class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
                </a><a class="brand" href="">
                    <img src="@Url.Content("~/Content/img/home.png")" width="25px" height="25px" style="margin:-15px 0px -5px; padding:0px;" alt="home" />
                    @Model.VendorTitle</a>
                @if (Model.FacebookSession == null)
                {
                    <div id="login-with-facebook" class="fb-login-button pull-right hidden-phone" style="height: 30px;
                        margin-top: 8px;">
                        Conectarse con Facebook
                    </div>
                }
                else
                {
                    <div class="btn-group pull-right hidden-phone">
                        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 3px 4px;">
                            <img width="20px" height="20px" src="@Model.FacebookSession.Picture" alt="" id="profile_pic_header_@Model.FacebookSession.Id" style="margin-left:2px">
                            <span class="headerTinymanName">@Model.FacebookSession.Name</span>
                            <span class="caret" style="margin-top: 10px;"></span></a>
                        <ul class="dropdown-menu">
                            <!--<li><a href="@Url.Action("FacebookLogout", "Home")">Salir</a></li>-->
                            <li><a href="#" onclick="FacebookLogout();">Salir</a></li>
                        </ul>
                    </div>
                }
                    <div class="nav-collapse">
                @if (Model.FacebookSession != null)
                {
                        <ul class="nav pull-right">
                            <li id="li-coincidences"><a href="#coincidencias">Coincidencias <span class="badge badge-inverse">
                                0</span></a></li>
                            <li id="li-suggestions"><a href="#sugeridos">Sugerencias <span class="badge badge-inverse">
                                0</span></a></li>
                        </ul>
                }
                    </div>
                <!--/.nav-collapse -->
            </div>
        </div>
    </div>
    <div class="container">
        @RenderBody()

    </div>
	<!-- /container -->
    <div class="container">
	<footer>
		<p>
			Inspired by Asterix &copy; 2012 - <a href="">Acerca de</a> - <a href="">Legal</a>
			- <a href="">Políticas de Privacidad</a></p>
	</footer>
    </div>
    <div id="fb-root">
    </div>
    <script type="text/javascript">
          window.fbAsyncInit = function () {
              FB.init({
                  appId: '341441029270984', // App ID
                  channelUrl: '//localhost/props.web.com/channel.html', // Channel File
                  status: true, // check login status
                  cookie: true, // enable cookies to allow the server to access the session
                  xfbml: true  // parse XFBML
              });

              FB.Event.subscribe('auth.authResponseChange', function (response) {
                  if (response.status === 'connected') {
                      // the user is logged in and has authenticated your
                      // app, and response.authResponse supplies
                      // the user's ID, a valid access token, a signed
                      // request, and the time the access token 
                      // and signed request each expire
                      var uid = response.authResponse.userID;
                      var accessToken = response.authResponse.accessToken;

                      // Do a post to the server to finish the logon
                      // This is a form post since we don't want to use AJAX
                      @if (Model.FacebookSession == null)
                      {
                        <text>
                          var form = document.createElement("form");
                          form.setAttribute("method", 'post');
                          form.setAttribute("action", '@Url.Action("FacebookLogin", "Home")');

                          var field = document.createElement("input");
                          field.setAttribute("type", "hidden");
                          field.setAttribute("name", 'accessToken');
                          field.setAttribute("value", accessToken);
                          form.appendChild(field);

                          document.body.appendChild(form);
                          form.submit();
                        </text>
                      }
                  } else if (response.status === 'not_authorized') {
                      // the user is logged in to Facebook, 
                      // but has not authenticated your app
                      alert('not authorized');
                  } else {
                      // the user isn't logged in to Facebook.
                      $("#login-with-facebook").show();
                  }
              });
          };

          // Load the SDK Asynchronously
          (function (d) {
              var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
              if (d.getElementById(id)) { return; }
              js = d.createElement('script'); js.id = id; js.async = true;
              js.src = "//connect.facebook.net/en_US/all.js";
              ref.parentNode.insertBefore(js, ref);
          } (document));

          function FacebookLogout(){
            FB.logout(); 
            location.reload();
          }
    </script>
    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/javascript" src="@Url.Content("~/content/js/jquery.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-transition.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-alert.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-modal.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-dropdown.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-scrollspy.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-tab.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-tooltip.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-popover.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-button.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-collapse.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-carousel.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/bootstrap-typeahead.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/content/js/app.js")"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#li-coincidences").popover({
                placement: 'bottom',
                title: 'Coincidencias',
                content: 'Encuentre aquí nuevos avisos publicados que coinciden con sus anteriores búsquedas',
                delay: { show: 200, hide: 200 }
            });

            $("#li-suggestions").popover({
                placement: 'bottom',
                title: 'Sugerencias',
                content: 'Encuentre aquí avisos similares a sus anteriores búsquedas que podrían resultarles interesantes.',
                delay: { show: 200, hide: 200 }
            });

        });
    </script>
</body>
</html>
